<?php
namespace app\common\model;

use think\Model;
use think\Db;


class ZhiyuanCard extends Model
{
    protected $pk = 'id';
    protected $autoWriteTimestamp = true;
    protected $table = 'think_zhiyuan_card';
    
    
    public static function GeneCardNo($number = '', $date = 'ymdHis') {
        $arr = explode(" ", microtime());
        $usec = substr(str_replace('0.', '', $arr[0]), 3, 3) . rand(100, 999);
        return $number . date($date) . $usec;
    }
	
	public static function GeneCardPwd($string,$length = 8, $char = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
        if(!is_int($length) || $length < 0) {
            return false;
        }
        for($i = strlen($string); $i < $length; $i++) {
            $string .= $char[mt_rand(0, strlen($char) - 1)];
        }
        return $string;
    }
}


?>